package com.project.zsxd.server.article.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.project.zsxd.server.article.entity.Article;
import com.project.zsxd.server.article.mapper.ArticleMapper;
import com.project.zsxd.server.article.service.IArticleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 文章表 服务实现类
 * </p>
 *
 * @author kaler
 * @since 2021-07-05
 */
@Service
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements IArticleService {

    @Override
    public List<Article> queryArticlesByType(String articleType) {
        QueryWrapper<Article> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("type", articleType)
                .eq("status", "A")
                .orderByDesc("updated_time");
        List<Article> articles = list(queryWrapper);
        return articles;
    }
}
